import About from '@/views/About'
import Home from '@/views/Home'
import Index from '@/views/Index'
import Login from '@/views/Login'
// import { createBrowserRouter, Navigate } from 'react-router-dom'
import { createHashRouter, Navigate } from 'react-router-dom'

const Router = createHashRouter([
    {
        path: '/home',
        element: <Home/>,
        children: [
            {
                path: 'index',
                element: <Index/>
            },
            {
                path: 'pa',
                lazy: () => import("@/views/Pa") // 懒加载
            },
            {
                path: 'pb',
                lazy: () => import("@/views/Pb") // 懒加载
            },
            {
                path: 'about',
                element: <About/>, //非懒加载
            }
        ]
    },
    {
        path: '/login',
        element: <Login/>
    },
    {
        path: '/',
        element: <Navigate to="/home/index"/>
    },
    {
        path: '*',
        lazy: () => import("@/views/404"),
        // element: <Navigate to="/home"/>
    }
])

export default Router